#include <lbvh\lbvh.h>
#include <time.h>

using namespace gc;


int animation_to_file(int argc, char** argv) {
	SimpleBox scenebox;
	scenebox.center = { 500,500,500 };
	scenebox.halfSize = { 500,500,500 };

	
	BouncingBallSimulation sim(scenebox);
	//if (strcmp(argv[1], "0")) sim.fLog = NULL;
	//else 
		sim.setOutputPath(argv[1]);
	int n_balls = atoi(argv[2]);
	int max_v = atoi(argv[3]);
	Float dt = atof(argv[4]);
	int n_frames = atoi(argv[5]);

	sim.setTimePerFrame(dt);
	sim.generateBalls(n_balls,max_v);


	for (int i = 0; i < n_frames; ++i) {
		sim.produceFrame();
	}

	//fprintf(stdout, "Performance of %d-body broad phase: %.3f ms/frame\n", n_balls, sim.timePerBroadPhase());
	//fprintf(stdout, "Performance of %d-body collision: %.3f ms/frame\n", n_balls, sim.timePerFrame());
	sim.printTimeInfo();
	system("pause");
	return 0;
}

int main2(int argc, char** argv) {
	return animation_to_file(argc, argv);
}
